home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / programming / c / pmm / developer / include / stringlib.h < prev   
C/C++ Source or Header  |  1999-06-14  |  10KB  |  305 lines

  1. /*
  2.  *    $VER: stringlib.h V1.2 (11.12.98) for free use
  3.  *
  4.  *  #define VBCC needed for VBCC
  5.  *  #define MANX needed for Aztec-C
  6.  *
  7.  *  
  8.  *
  9.  *    Include this file at your source and link the stringlib_(CPU).lib
  10.  *    If nessasary add here your own ALIAS or anything else.
  11.  *  All Lib-functions hast first char as uppercase.
  12.  *  The following defines will change that to standardnames (lowercase).
  13.  *
  14.  *  You can delete all defines of functions that your compiler support
  15.  *  to mix this functions with originals. You also can overwrite the
  16.  *  compilerfunctions, if you really want that.
  17.  *
  18.  *  You will find functions that seems to be duplicate. This is not
  19.  *  right. For example, take a look of strlower and strlwr. Shure,
  20.  *  both functions take a string and change all chars to lowercase.
  21.  *  One work with pointeroncrement, the other with the stringfield.
  22.  *  Duplicates generell: Most, there is a fast and a secure version.
  23.  *  Both must be work correct.But if not, take the other. In the future
  24.  *  i will make a table with speedtest's and document that detailed.
  25.  *
  26.  *  IMPORTANT!
  27.  *  **********
  28.  *  To use the defines in this file the STRINGLIB.lib must be included
  29.  *  bevor this file. Otherwise it can and will not work. It may be that
  30.  *  your linker work of another way and you can include the lib later.
  31.  *  Normally it will make problems. If your linker don't work correctly
  32.  *  with this file you must use the internal names directly.
  33.  *
  34.  *    RELEASENOTES:
  35.  *  -------------
  36.  *
  37.  *    VBCC: To use with vbcc you have two alternatives:
  38.  *
  39.  *       1.) don't include 'string.h', ignore original vbcc-functions.
  40.  *
  41.  *       2.) BETTER: define VBCC and include string.h. this will add all
  42.  *           functions that not implemented but the duplicates will not
  43.  *           the default. Use lib-functions with the first letter
  44.  *           uppercase. 
  45.  *
  46.  * MANX: The define's are now obsolete, aztec has own lib-format and
  47.  *       can not read actual release.
  48.  *       If you work with Aztec: let me know, i can create the lib
  49.  *       for Manx.
  50.  *
  51.  * other: correct ths file, best you lock in your string(s).h-include
  52.  *        to see what your compiler support. If you send me this file
  53.  *        updated back, i will include the defines for future use.
  54.  */
  55.  
  56. #ifndef _STRING_LIB_DEF
  57. #define _STRING_LIB_DEF 1
  58.  
  59. #include <ctype.h>
  60. #include "STRINGLIB_protos.h"    /* automatic generated from pmm */
  61.  
  62.     /* MANX Aztec named it swapmem...
  63.      *
  64.      * ...and my own programs use swapmem
  65.      */
  66.  
  67. #ifndef MANX
  68. #define        swapmem (register char *s1, register char *s2, register int n)\
  69.             Swap (register char *s1, register char *s2, register int n)
  70. #endif
  71.  
  72.     /* Alias-List for "normal" functionnames */
  73.  
  74. #define        bcmp (const char *s1, const char *s2, int length)\
  75.             Bcmp (const char *s1, const char *s2, int length)
  76. #define        bcopy (const char *src, char *dst, int length)\
  77.             Bcopy (const char *src, char *dst, int length)
  78. #define        bzero (char *dst, int length)\
  79.             Bzero (char *dst, int length)
  80.  
  81. #ifndef MANX
  82. #define        index (char *s, char charwanted)\
  83.             Index (char *s, char charwanted)
  84. #endif
  85.  
  86. #define        lmemmove (register char *dest, register char *source, register long len)\
  87.             Lmemmove (register char *dest, register char *source, register long len)
  88.  
  89. #ifndef MANX
  90. #define        memccpy (char *dst, const char *src, char ucharstop, int size)\
  91.             Memccpy (char *dst, const char *src, char ucharstop, int size)
  92. #ifndef VBCC
  93. #define        memchr (char *s, register char uc, int size)\
  94.             Memchr (char *s, register char uc, int size)
  95. #define        memcmp (const char *s1, const char * s2, int size)\
  96.             Memcmp (const char *s1, const char * s2, int size)
  97. #define        memcpy (char *dst, const char * src, int size)\
  98.             Memcpy (char *dst, const char * src, int size)
  99. #endif
  100. #endif
  101.  
  102. #define        memicmp (register char *mem1, register char *mem2, register int len)\
  103.             Memicmp (register char *mem1, register char *mem2, register int len)
  104.  
  105. #ifndef MANX
  106. #ifndef VBCC
  107. #define        memmove (void *s1, const void *s2, int n)\
  108.             Memmove (void *s1, const void *s2, int n)
  109. #endif
  110. #endif
  111.  
  112. #define        memncmp (char *a, char *b, int length)\
  113.             Memncmp (char *a, char *b, int length)
  114.  
  115. #ifndef MANX
  116. #ifndef VBCC
  117. #define        memset (char *s, register char ucharfill, int size)\
  118.             Memset (char *s, register char ucharfill, int size)
  119. #endif
  120. #define        rindex (char *s, char charwanted)\
  121.             Rindex (char *s, char charwanted)
  122. #endif
  123.  
  124. #define        stpchr (const char *str, char c)\
  125.             Stpchr (const char *str, char c)
  126. #define        stpcpy (char *d, const char *s)\
  127.             Stpcpy (char *d, const char *s)
  128. #define        stradj (register char *string, register int dir)\
  129.             Stradj (register char *string, register int dir)
  130. #define        strbpl (char **av, int max, char *sary)\
  131.             Strbpl (char **av, int max, char *sary)
  132. #define        strcasecmp (const char *s, const char *d)\
  133.             Strcasecmp (const char *s, const char *d)
  134.  
  135. #ifndef MANX
  136. #ifndef VBCC
  137. #define        strcat (char *dst, const char *src)\
  138.             Strcat (char *dst, const char *src)
  139. #define        strchr (char *s, register char charwanted)\
  140.             Strchr (char *s, register char charwanted)
  141. #define        strcmp (const char *s1, const char *s2)\
  142.             Strcmp (const char *s1, const char *s2)
  143. #define        strcpy (char *dst, const char *src)\
  144.             Strcpy (char *dst, const char *src)
  145. #define        strcspn (const char *s, const char *reject)\
  146.             Strcspn (const char *s, const char *reject)
  147. #endif
  148. #endif
  149.  
  150. #define        strdcat (char *s1, char *s2)\
  151.             Strdcat (char *s1, char *s2)
  152.  
  153. #ifndef MANX
  154. #ifndef VBCC
  155. #define        strdup (char *string)\
  156.             Strdup (char *string)
  157. #endif
  158. #define        stricmp (const char *str1, const char *str2)\
  159.             Stricmp (const char *str1, const char *str2)
  160. #endif
  161.  
  162. #define        strins (char *d, const char *s)\
  163.             Strins (char *d, const char *s)
  164. #define        strinstr (char *s, int c)\
  165.             Strinstr (char *s, int c)
  166. #define        strirpl (char *string, char *ptrn, register char *rpl, register int n)\
  167.             Strirpl (char *string, char *ptrn, register char *rpl, register int n)
  168. #define        stristr (register char *string, register char *pattern)\
  169.             Stristr (register char *string, register char *pattern)
  170.  
  171. #ifndef MANX
  172. #ifndef VBCC
  173. #define        strlen (const char *s)\
  174.             Strlen (const char *s)
  175. #endif
  176. #endif
  177.  
  178. #define        strlencmp (char *s, char *t, int n)\
  179.             Strlencmp (char *s, char *t, int n)
  180. #define        strlower (char *s)\
  181.             Strlower (char *s)
  182.  
  183. #ifndef MANX
  184. #define        strlwr (register char *string)\
  185.             Strlwr (register char *string)
  186. #endif
  187.  
  188. #define        strncasecmp (const char *s, const char *d, int n)\
  189.             Strncasecmp (const char *s, const char *d, int n)
  190.  
  191. #ifndef MANX
  192. #ifndef VBCC
  193. #define        strncat (char *dst, const char *src, int n)\
  194.             Strncat (char *dst, const char *src, int n)
  195. #define        strncmp (const char *s1, const char *s2, int n)\
  196.             Strncmp (const char *s1, const char *s2, int n)
  197. #define        strncpy (char *dst, const char *src, int n)\
  198.             Strncpy (char *dst, const char *src, int n)
  199. #endif
  200. #endif
  201.  
  202. #define        strndup (char *string, int n)\
  203.             Strndup (char *string, int n)
  204.  
  205. #ifndef MANX
  206. #define        strnicmp (const char *str1, const char *str2, int n)\
  207.             Strnicmp (const char *str1, const char *str2, int n)
  208. #endif
  209.  
  210. #define        strnset (char *string, register char c, register int n)\
  211.             Strnset (char *string, register char c, register int n)
  212.  
  213. #ifndef MANX
  214. #ifndef VBCC
  215. #define        strpbrk (char *s, char *breakat)\
  216.             Strpbrk (char *s, char *breakat)
  217. #endif
  218. #endif
  219.  
  220. #define        strpcpy (register char *dest, register char *start, register char *end)\
  221.             Strpcpy (register char *dest, register char *start, register char *end)
  222. #define        strpos (register char *string, register char symbol)\
  223.             Strpos (register char *string, register char symbol)
  224.  
  225. #ifndef MANX
  226. #ifndef VBCC
  227. #define        strrchr (char *s, register char charwanted)\
  228.             Strrchr (char *s, register char charwanted)
  229. #endif
  230. #endif
  231.  
  232. #define        strrev (char *string)\
  233.             Strrev (char *string)
  234. #define        strrpbrk (register char *string, register char *set)\
  235.             Strrpbrk (register char *string, register char *set)
  236. #define        strrpl (char *string, char *ptrn, register char *rpl, register int n)\
  237.             Strrpl (char *string, char *ptrn, register char *rpl, register int n)
  238. #define        strrpos (register char *string, register char symbol)\
  239.             Strrpos (register char *string, register char symbol)
  240. #define        strset (char *string, register char c)\
  241.             Strset (char *string, register char c)
  242.  
  243. #ifndef MANX
  244. #ifndef VBCC
  245. #define        strspn (const char *s, const char *accept)\
  246.             Strspn (const char *s, const char *accept)
  247. #define        strstr (char *s, char *wanted)\
  248.             Strstr (char *s, char *wanted)
  249. #define        strtod (char *string, char **ptr)\
  250.             Strtod (char *string, char **ptr)
  251. #define        strtok (char *s, register const char *delim)\
  252.             Strtok (char *s, register const char *delim)
  253. #define        strtol (char *ptr, char **tail, int base)\
  254.             Strtol (char *ptr, char **tail, int base)
  255. #endif
  256. #endif
  257.  
  258. #define        strtolong (char *string, long *value)\
  259.             Strtolong (char *string, long *value)
  260. #define        strtosd (char *string, char **ptr, double base)\
  261.             Strtosd (char *string, char **ptr, double base)
  262. #define        strtosud (char *string, char **ptr, double base)\
  263.             Strtosud (char *string, char **ptr, double base)
  264.  
  265. #ifndef MANX
  266. #ifndef VBCC
  267. #define        strtoul (char *ptr,char **tail, int base)\
  268.             Strtoul (char *ptr,char **tail, int base)
  269. #endif
  270. #endif
  271.  
  272. #define        strtrim (register char *string, register char *junk)\
  273.             Strtrim (register char *string, register char *junk)
  274. #define        strupp (char *pc)\
  275.             Strupp (char *pc)
  276. #define        strupper (char *s)\
  277.             Strupper (char *s)
  278.  
  279. #ifndef MANX
  280. #define        strupr (register char *string)\
  281.             Strupr (register char *string)
  282. #endif
  283.  
  284. #define        subnstr (register char *dest, register char *source, register int start, register int end,register int length)\
  285.             Subnstr (register char *dest, register char *source, register int start, register int end,register int length)
  286. #define        substr (register char *dest, register char *source, register int start, register int end)\
  287.             Substr (register char *dest, register char *source, register int start, register int end)
  288. #define        swap (register char *s1, register char *s2, register int n)\
  289.             Swap (register char *s1, register char *s2, register int n)
  290.  
  291. #ifndef MANX
  292. #ifndef VBCC
  293. #define        tolower (char c)\
  294.             Tolower (char c)
  295. #define        toupper (char c)\
  296.             Toupper (char c)
  297. #endif
  298. #endif
  299.  
  300. #endif
  301.  
  302. /*
  303.  *  end of file
  304.  */
  305.